/*
 * 查询报告
 * */

package com.axt.dbaudit.bean.query.report;

import java.util.List;

import com.axt.dbaudit.base.MsgFuncExt;
import com.axt.dbaudit.base.QueryFilter;
import com.axt.dbaudit.base.QueryType;
import com.axt.dbaudit.base.StatDim;
import com.axt.dbaudit.bean.query.QueryBaseBean;
import com.axt.dbaudit.model.query.report.FlowByClientIp;
import com.axt.dbaudit.model.query.report.FlowByClientIpSort;
import com.axt.dbaudit.model.query.report.FlowByTime;
import com.axt.soa.msg.types.MsgErrorCode;
import com.axt.soa.msg.types.MsgParam;

public class QueryReportFlowBean extends QueryBaseBean {
	/* 流量统计 根据时间范围统计 */

	public List<FlowByTime> getFlowByTimes() {
		try {
			return (List<FlowByTime>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<FlowByClientIp> getFlowByClientIps() {
		try {
			return (List<FlowByClientIp>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<FlowByClientIpSort> getFlowByClientIpSorts() {
		try {
			return (List<FlowByClientIpSort>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}

	/* stop query flow report indices */
	public int stopQueryIndices(String serverPath) {

		init();
		setQueryType(QueryType.STAT_T_FLOW);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_STOP_REPORT, serverPath);
	}

	// 按时间统计流量
	public int StatForFlowsByTimeRgn(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 流量统计 根据时间范围统计 查询结果 */
	public int StatForFlowsByTimeRgnData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.FlowByTime");
	}

	// 流量统计报表 根据客户端IP统计 查索引
	public int StatForFlowsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	// 流量统计报表 根据客户端IP统计 取数据
	public int StatForFlowsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.FlowByClientIp");
	}

	// 流量统计报表 根据客户端IP排序 -1是根据全部流量排
	public int SortForFlowsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	// 流量统计报表 根据客户端IP排序 -1是根据全部流量排
	public int SortForFlowsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
		"com.axt.dbaudit.model.query.report.FlowByClientIpSort");
	}
	
	// 流量统计报表 根据客户端IP排序,  0是根据客户端流量排，1是根据服务器流量排
	public int SortForFlowsByCliIPSvrFlow(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_SVR_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	// 流量统计报表 根据客户端IP排序 ，0是根据客户端流量排，1是根据服务器流量排
	public int SortForFlowsByCliIPSvrFlowData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_SVR_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
		"com.axt.dbaudit.model.query.report.FlowByClientIpSort");
	}
	
	// 流量统计报表 根据客户端IP排序,  0是根据客户端流量排，1是根据服务器流量排
	public int SortForFlowsByCliIPCliFlow(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_CLI_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	// 流量统计报表 根据客户端IP排序 ，0是根据客户端流量排，1是根据服务器流量排
	public int SortForFlowsByCliIPCliFlowData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {
		setQueryType(QueryType.STAT_T_CLI_FLOW);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
		"com.axt.dbaudit.model.query.report.FlowByClientIpSort");
	}
}
